﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using University.Workshop.Model;
using University.Workshop.Business;
using University.Workshop.Presenters.AppointmentFolder;

namespace University.Workshop.WinApp
{
    public partial class AppointmentReminder : Form,IAppointmentReminder
    {
        string tomorrowDate;
        string currentDate;
        DateTime cDate = DateTime.Today;
        DateTime tDate = DateTime.Today.AddDays(1);
        User loggedUser;
        PresenterAppointmentReminder presenter;
        List<Appointment> appointments;

        public AppointmentReminder()
        {
            InitializeComponent();
            presenter = new PresenterAppointmentReminder(this);
            currentDate = cDate.ToString("dd/MM/yyyy");
            tomorrowDate = tDate.ToString("M/dd/yyyy");
        }

        public AppointmentReminder(User user)
        {
            InitializeComponent();
            presenter = new PresenterAppointmentReminder(this);
            currentDate = cDate.ToString("dd/MM/yyyy");
            tomorrowDate = tDate.ToString("M/dd/yyyy");
            loggedUser = user;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            appointments = (List<Appointment>)presenter.AppointmentReminder();
            DataAppointemetsTomorrow.DataSource = appointments;
        }

        #region Miembros de IAppointementReminder

        public string DateTomorrow
        {
            get
            {
                return tomorrowDate;
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        #endregion

        private void AppointementReminder_Load(object sender, EventArgs e)
        {
            label2.Text = loggedUser.LastName;
            label4.Text = currentDate;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
